#include "types.h"
#include "stat.h"
#include "user.h"

volatile int data = 0;

void f(void *arg)
{
    sleep(3);
    data = 32323;
    printf(1,"%s\n",arg);
    sleep(1000);
    exit();
}

int main(void)
{
  int pid = thread(f,"hello, thread");
  if (pid < 0)
    printf(1,"thread() failed\n");
  else {
    printf(1,"waiting...\n");
    wait();
    printf(1,"done waiting\n");
    printf(1, "main thread data: %d\n", data);
    sleep(1000);
  }
  exit();
}
